<template>

</template>

<script>
  import reqApi from "../../api/api.js";
  export default {
    data() {
      return {
        show: true
      }
    },
    onShow() {
      let token = uni.getStorageSync('token');
      console.log("token", token);
      if (token) {
        this.getUserInfo();
      } else {
        uni.reLaunch({
          url: "/pages/login/index"
        })
      }
    },
    methods: {
      getUserInfo() {
        reqApi.getUserInfo({}).then(resp => {
          uni.setStorageSync("userInfo", resp.data);
          console.log("用户信息", resp.data);
          // is_operation 是否运营  is_seller是否商务
          if (resp.data.phone) {
            if (resp.data.is_operation == 1) {
              uni.reLaunch({
                url: "/pages/order/orderList"
              })
            }
            if (resp.data.is_seller == 1) {
              uni.reLaunch({
                url: "/pages/order/takeOrderList"
              })
            }
          }else{
            uni.clearStorageSync();
            uni.reLaunch({
              url: "/pages/login/index"
            })
          }
        })
      }
    }
  }
</script>

<style>
</style>